<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Choose a picture.</title>
</head>

<body>
<script type="text/javascript">
function addToPage(string)
{
	window.opener.document.forms['formSaisie'].image.value=string;
	window.close();
}
</script>
<?php
$path = './';
$dir_handle = @opendir($path) or die('Unable to open ' . $path);
$array = array();
while (($file = readdir($dir_handle)) !== false)
{
	if ($file != '.' && $file != '..')
	{
	$pathinfo = pathinfo($file);
	if (isset($pathinfo['extension'])) {$ext = strtolower($pathinfo['extension']);} else {$ext = '';}
	if ($ext == 'png' || $ext == 'jpg') {$array[] = $file;}
	}
}

if ($array)
{
sort($array);
	foreach ($array as $value)
	{
		if($value != "design.png" && $value != "design2.png")
		echo '<a href="javascript:addToPage(\''.$value.'\')"><img src="' . $path . $value . '" /></a>';

	}
}
?>
</body>
</html>